using System;

namespace org.synthful.Number
{
    public class IntegerValue
    {
        /// <summary>
        /// Offered under Apache Public Licence 2.0
        /// synthful.org
        /// blessedgeek [@] synthful.org
        /// </summary>
        public IntegerValue(int i)
        {
            Value = i;
        }

        public int Value;

        public static implicit operator int(IntegerValue I)
        {
            return I.Value;
        }
        public static implicit operator uint(IntegerValue I)
        {
            return (uint)I.Value;
        }
        public static implicit operator float(IntegerValue I)
        {
            return Convert.ToSingle(I.Value);
        }
        public static implicit operator double(IntegerValue I)
        {
            return Convert.ToDouble(I.Value);
        }
        public static implicit operator byte(IntegerValue I)
        {
            return Convert.ToByte(I.Value);
        }
        public static implicit operator char(IntegerValue I)
        {
            return Convert.ToChar(I.Value);
        }

        public static implicit operator IntegerValue(int i)
        {
            return new IntegerValue(i);
        }

        public static IntegerValue operator -(IntegerValue I, int i)
        {
            return new IntegerValue(I.Value - i);
        }
        public static IntegerValue operator +(IntegerValue I, int i)
        {
            return new IntegerValue(I.Value + i);
        }

        public static IntegerValue operator --(IntegerValue I)
        {
            I.Value--;
            return I;
        }
        public static IntegerValue operator ++(IntegerValue I)
        {
            I.Value++;
            return I;
        }

        public static bool operator >(IntegerValue I, int i)
        {
            return I.Value > i;
        }
        public static bool operator <(IntegerValue I, int i)
        {
            return I.Value < i;
        }

        public static bool operator >=(IntegerValue I, int i)
        {
            return I.Value >= i;
        }
        public static bool operator <=(IntegerValue I, int i)
        {
            return I.Value <= i;
        }

        public string toString()
        {
            return Value.ToString();
        }
        public string toString(IFormatProvider ifp)
        {
            return Value.ToString(ifp);
        }
        public string toString(string format)
        {
            return Value.ToString(format);
        }
        public string toString(string format, IFormatProvider ifp)
        {
            return Value.ToString(format, ifp);
        }
    }
}
